home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr05 / ddeexamp.zip / STDDDE.H < prev    next >
C/C++ Source or Header  |  1993-07-08  |  7KB  |  202 lines

  1. /*
  2.     stddde.h
  3.  
  4.     This header file defines all the constants, structures
  5.     and APIs used to interface with stddde.c.
  6.  
  7.     You should include this header file in your own application
  8.     after windows.h
  9.  
  10. */
  11.  
  12. #ifndef _STDDDE_
  13. #define _STDDDE_
  14.  
  15. #include <ddeml.h>
  16.  
  17. //
  18. // String names for standard Windows Clipboard formats
  19. //
  20.  
  21. #define SZCF_TEXT           "TEXT"        
  22. #define SZCF_BITMAP         "BITMAP"      
  23. #define SZCF_METAFILEPICT   "METAFILEPICT"
  24. #define SZCF_SYLK           "SYLK"        
  25. #define SZCF_DIF            "DIF"         
  26. #define SZCF_TIFF           "TIFF"        
  27. #define SZCF_OEMTEXT        "OEMTEXT"     
  28. #define SZCF_DIB            "DIB"         
  29. #define SZCF_PALETTE        "PALETTE"     
  30. #define SZCF_PENDATA        "PENDATA"     
  31. #define SZCF_RIFF           "RIFF"     
  32. #define SZCF_WAVE           "WAVE"     
  33. #define SZCF_UNICODETEXT    "UNICODETEXT" 
  34. #define SZCF_ENHMETAFILE    "ENHMETAFILE" 
  35.  
  36. //
  37. // String names for some standard DDE strings not
  38. // defined in DDEML.H
  39. //
  40.  
  41. #define SZ_READY            "Ready"
  42. #define SZ_BUSY             "Busy"
  43. #define SZ_TAB              "\t"
  44. #define SZ_RESULT           "Result"
  45. #define SZ_PROTOCOLS        "Protocols"
  46. #define SZ_EXECUTECONTROL1  "Execute Control 1"
  47.  
  48. //
  49. // Definition for a DDE Request processing function
  50. //
  51.  
  52. typedef HDDEDATA (DDEREQUESTFN)(UINT wFmt, HSZ hszTopic, HSZ hszItem);
  53. typedef DDEREQUESTFN *PDDEREQUESTFN;
  54.  
  55. //
  56. // Definition for a DDE Poke processing function
  57. //
  58.  
  59. typedef BOOL (DDEPOKEFN)(UINT wFmt, HSZ hszTopic, HSZ hszItem, HDDEDATA hData);
  60. typedef DDEPOKEFN *PDDEPOKEFN;
  61.  
  62. //
  63. // Definition for a DDE Execute processing function
  64. //
  65.  
  66. typedef BOOL (DDEEXECFN)(HSZ hszTopic, HDDEDATA hData);
  67. typedef DDEEXECFN *PDDEEXECFN;
  68.  
  69. //
  70. // Definition for a DDE execute command procession function
  71. //
  72.  
  73. typedef BOOL (DDEEXECCMDFN)(struct _DDETOPICINFO FAR *pTopic,
  74.                             LPSTR pszResultString,
  75.                             UINT uiResultSize,
  76.                             UINT uiNargs,
  77.                             LPSTR FAR *ppArgs);
  78. typedef DDEEXECCMDFN FAR *PDDEEXECCMDFN;
  79.  
  80. //
  81. // Structure used to hold a clipboard id and its text name
  82. //
  83.  
  84. typedef struct _CFTAGNAME {
  85.     WORD wFmt;
  86.     LPSTR pszName;
  87. } CFTAGNAME, FAR *PCFTAGNAME;
  88.  
  89. //
  90. // Structure used to store information on a DDE execute
  91. // command processor function
  92. //
  93.  
  94. typedef struct _DDEEXECCMDFNINFO {
  95.     struct _DDEEXECCMDFNINFO FAR *pNext; // pointer to the next item
  96.     struct _DDETOPICINFO FAR *pTopic; // pointer to the topic it belongs to
  97.     LPSTR pszCmdName;           // The name of the command
  98.     PDDEEXECCMDFN pFn;          // A pointer to the function
  99.     UINT uiMinArgs;             // min number of args
  100.     UINT uiMaxArgs;             // max number of args
  101. } DDEEXECCMDFNINFO, FAR *PDDEEXECCMDFNINFO;
  102.  
  103. //
  104. // Structure used to store information on a DDE item
  105. //
  106.  
  107. typedef struct _DDEITEMINFO {
  108.     struct _DDEITEMINFO FAR *pNext; // pointer to the next item
  109.     LPSTR   pszItemName;        // pointer to its string name
  110.     HSZ     hszItemName;        // DDE string handle for the name
  111.     struct _DDETOPICINFO FAR *pTopic; // pointer to the topic it belongs to
  112.     LPWORD  pFormatList;        // ptr to null term list of CF format words.
  113.     PDDEREQUESTFN pfnRequest;   // pointer to the item specific request processor
  114.     PDDEPOKEFN    pfnPoke;      // pointer to the item specific poke processor
  115.     HDDEDATA    hData;          // data for this item (not used by stddde.c)
  116. } DDEITEMINFO, FAR *PDDEITEMINFO;
  117.  
  118. //
  119. // Structure used to store information on a DDE topic
  120. //
  121.  
  122. typedef struct _DDETOPICINFO {
  123.     struct _DDETOPICINFO FAR *pNext;// pointer to the next topic
  124.     LPSTR   pszTopicName;       // pointer to its string name
  125.     HSZ     hszTopicName;       // DDE string handle for the name
  126.     PDDEITEMINFO pItemList;     // pointer to its item list
  127.     PDDEEXECFN  pfnExec;        // pointer to the generic execute processor
  128.     PDDEREQUESTFN pfnRequest;   // pointer to the generic request processor
  129.     PDDEPOKEFN    pfnPoke;      // pointer to the generic poke processor
  130.     PDDEEXECCMDFNINFO pCmdList; // pointer to the execute command list
  131. } DDETOPICINFO, FAR *PDDETOPICINFO;
  132.  
  133. //
  134. // Structure used to store information about a DDE conversation
  135. //
  136.  
  137. typedef struct _DDECONVINFO {
  138.     struct _DDECONVINFO FAR *pNext; // pointer to the next one
  139.     HCONV hConv;                    // handle to the conversation
  140.     HSZ hszTopicName;               // HSZ for the topic of the conversation
  141.     PDDEITEMINFO pResultItem;       // pointer to a temp result item
  142. } DDECONVINFO, FAR *PDDECONVINFO;
  143.  
  144. //
  145. // Structure used to store information on a DDE server
  146. // which has only one service
  147. //
  148.  
  149. typedef struct _DDESERVERINFO {
  150.     LPSTR   lpszServiceName;        // pointer to the service string name
  151.     HSZ     hszServiceName;         // DDE string handle for the name
  152.     PDDETOPICINFO pTopicList;       // pointer to the topic list
  153.     DWORD dwDDEInstance;            // DDE Instance value
  154.     PFNCALLBACK pfnStdCallback;     // pointer to standard DDE callback fn
  155.     PFNCALLBACK pfnCustomCallback;  // pointer to custom DDE callback fn
  156.     PDDECONVINFO pConvList;         // pointer to the active conversation list
  157. } DDESERVERINFO, FAR *PDDESERVERINFO;
  158.  
  159. //
  160. // Functions provided by stddde.c
  161. //
  162.  
  163. extern BOOL InitializeDDE(HANDLE hInstance,
  164.                           LPSTR lpszServiceName,
  165.                           LPDWORD lpdwDDEInst,
  166.                           PFNCALLBACK lpfnCustomCallback,
  167.                           DWORD dwFilterFlags);
  168.  
  169. extern void UninitializeDDE(void);
  170.  
  171. extern PDDETOPICINFO AddDDETopic(LPSTR lpszTopic,
  172.                                  PDDEEXECFN pfnExec,     
  173.                                  PDDEREQUESTFN pfnRequest,
  174.                                  PDDEPOKEFN pfnPoke);
  175. extern BOOL RemoveDDETopic(LPSTR lpszTopic);
  176.  
  177. extern PDDEITEMINFO AddDDEItem(LPSTR lpszTopic, 
  178.                                LPSTR lpszItem, 
  179.                                LPWORD pFormatList,
  180.                                PDDEREQUESTFN lpReqFn, 
  181.                                PDDEPOKEFN lpPokeFn);
  182. extern BOOL RemoveDDEItem(LPSTR lpszTopic, LPSTR lpszItem);
  183.  
  184. extern PDDEEXECCMDFNINFO AddDDEExecCmd(LPSTR pszTopic, 
  185.                                        LPSTR pszCmdName,
  186.                                        PDDEEXECCMDFN pExecCmdFn,
  187.                                        UINT uiMinArgs,
  188.                                        UINT uiMaxArgs);
  189.  
  190. extern BOOL RemoveDDEExecCmd(LPSTR pszTopic, LPSTR pszCmdName);
  191.  
  192. extern void PostDDEAdvise(PDDEITEMINFO pItemInfo);
  193. extern PDDETOPICINFO FindTopicFromName(LPSTR lpszName);
  194. extern PDDEITEMINFO FindItemFromName(PDDETOPICINFO pTopic, LPSTR lpszItem);
  195. extern PDDETOPICINFO FindTopicFromHsz(HSZ hszName);
  196. extern PDDEITEMINFO FindItemFromHsz(PDDETOPICINFO pTopic, HSZ hszItem);
  197. extern LPSTR GetCFNameFromId(WORD wFmt, LPSTR lpBuf, int iSize);
  198. extern WORD GetCFIdFromName(LPSTR pszName);
  199.  
  200.  
  201. #endif // _STDDDE_
  202.